package com.xbongbong.workflow.model;


import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.workflow.domain.entity.WorkflowNodeEntity;
import com.xbongbong.workflow.domain.entity.ext.WorkflowNodeEntityExt;

import java.util.Collection;
import java.util.List;
import java.util.Map;


/**
 * @author
 */
public interface WorkflowNodeModel extends IModel<WorkflowNodeEntity> {

   @Override
   Integer insert(WorkflowNodeEntity entity);

   void insertBatch(List<WorkflowNodeEntity> list);

   void insertExtBatch(List<WorkflowNodeEntityExt> list);

   @Override
   List<WorkflowNodeEntity> findEntitys(Map<String, Object> param);

   @Override
   Integer getEntitysCount(Map<String, Object> param);

   @Override
   Integer update(WorkflowNodeEntity entity);

   WorkflowNodeEntity getByKey(Long key, String corpid);
   
   WorkflowNodeEntityExt getExtByKey(Long key, String corpid);
   /**
    * 删除节点
    * @param key
    * @param corpid
    * @return
    */
   Integer deleteByKey(Long key, String corpid);

   /**
    * 获取节点
    * @param workflowId
    * @param prevId
    * @param corpid
    * @return
    */
   List<WorkflowNodeEntity> getByWorkflowIdAndPrevId(Long workflowId, String prevId, String corpid);

   /**
    * 批量删除
    * @param idIn
    * @param corpid
    * @return
    */
   Integer deleteBatch(Collection<Long> idIn, String corpid);
   /**
    * 删除
    * @param workflowIdList
    * @param corpid
    * @return
    */
   Integer deleteByWorkflowId(List<Long> workflowIdList, String corpid);
   /**
    * 获取节点
    * @param uId
    * @param workflowId
    * @param corpid
    * @return
    */
   WorkflowNodeEntity getByUId(Long workflowId,String corpid, String uId);
   
   
   List<WorkflowNodeEntityExt> list(Map<String, Object> param);

   /**
    * 根据工作流id获取工作流节点
    * @param corpid
    * @param workflowId
    * @param orderByStr
    * @return
    */
   List<WorkflowNodeEntity> getWorkflowNodeList(String corpid, Long workflowId, String orderByStr);

   /**
    * 根据工作流id获取工作流节点(包含已删除的节点)
    * @param corpid
    * @param workflowId
    * @return
    */
   List<WorkflowNodeEntity> getWorkflowNodeListIgnoreDel(String corpid, Long workflowId);

   /**
    * 批量更新块id
    * @param list
    * @param corpid
    * @return
    */
   Integer updateWrapperId(List<WorkflowNodeEntity> list, String corpid);
   /**
    * 更新wrapperId
    * wrapperId 未判空，请谨慎使用
    * @param list
    * @param wrapperId
    * @param corpid
    * @return
    */
   Integer updateWrapperIdByIdIn(List<Long> list, String wrapperId, String corpid);
   /**
    * 获取节点
    * @param idIn
    * @param corpid
    * @return
    */
    List<WorkflowNodeEntity> getByIdIn(Collection<Long> idIn, String corpid);

   /**
    * 排序
    * @param nodeList
    * @param corpid
    * @return
    */
    Integer sort(List<WorkflowNodeEntity> nodeList, String corpid);

   List<WorkflowNodeEntity> getByWrapperId(String wrapperId, String corpid, Long workflowId);

   /**
    * 批量保存配置
    * @param list
    * @param corpid
    */
    void updateConfigData(List<? extends WorkflowNodeEntity> list, String corpid);

    /**
     * 更新prevId
     * @param updateList
     * @param corpid
     * @return java.lang.Integer
     * @author 吴峰
     * @date 2022/3/23 20:01
     */
   Integer updatePrevIdBatch(List<WorkflowNodeEntity> updateList, String corpid);
}
